<template>
  <div>
      <topnav title="推荐码"></topnav>
      <div class="conetnt">
        <p>输入推荐码</p>
        <div>
        <input type="text" v-model="code">
        <a href="#"></a>
        </div>
      </div>
      <div class="footer">
          <button @click="inviter">确认</button>
      </div>
  </div>
</template>

<script>
import topnav from "../../components/topNav"
import api from "../../axios/api"
export default {
data(){
    return{
        code:null,
    }
},
components:{
    topnav
},
methods:{
    inviter(){
        let data={
            user_id:localStorage.getItem("id"),
            parent_id:this.code
        }
           this.$post(api.inviter,data).then(res=>{
        if(res.code == 0){
            this.$toast(res.msg)
            this.info = res.data
        }else{
            this.$toast(res.error)
        }
    })
       },
}
}
</script>

<style lang="less" scoped>
.conetnt{
    width: 95%;
    margin: 0 auto;
    margin-top: 10px;
    p{
        font-size: 14px;
        margin: 10px 0px;
    }
   
    input{
        width: 100%;
        height: 40px;
        background-color: #f6f6f6;
        border: none;
        color: #ff6508;
        text-indent: 1em;
        font-size: 20px;
        font-weight: 600;
    }
    a{
        display: block;
        width: 15px;
        height: 15px;
        background: url("../../assets/error.png") no-repeat;
        background-size: 100%;
    }
    div{
        display: flex;
        align-items: center;
        a{
            position: absolute;
            left: 90%;
        }
    }
    
}
.footer {
   text-align: center;
    margin-top: 300px;
    button{
        width: 90%;
        height: 50px;
        border: none;
        border-radius: 40px;
        margin-top: 10px;
        color: #fff;
        background-color: #ff6608;
    }
}
</style>